package com.chanyachting.emall.domain;

import java.lang.reflect.InvocationTargetException;
import java.util.List;

import org.apache.commons.beanutils.BeanUtils;

import com.chanyachting.emall.dao.EmallservicesDAO;
import com.chanyachting.emall.domain.base.BaseEmallservices;

/**
 * This is the object class that relates to the emallservices table.
 * Any customizations belong here.
 */
public class Emallservices extends BaseEmallservices {

/*[CONSTRUCTOR MARKER BEGIN]*/
	public Emallservices () {
		super();
	}

	/**
	 * Constructor for primary key
	 */
	public Emallservices (java.lang.Integer _id) {
		super(_id);
		
		Emallservices es=(Emallservices) new EmallservicesDAO().load(Emallservices.class, _id);
		
		if(es!=null){
			
			try {
				BeanUtils.copyProperties(this, es);
			} catch (IllegalAccessException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (InvocationTargetException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}

	/**
	 * Constructor for required fields
	 */
	public Emallservices (
		java.lang.Integer _id,
		java.lang.String _optionType,
		java.math.BigDecimal _servicePrice,
		java.lang.Integer _monthLimit,
		java.lang.String _serviceName,
		java.lang.String _createDate) {

		super (
			_id,
			_optionType,
			_servicePrice,
			_monthLimit,
			_serviceName,
			_createDate);
	}
/*[CONSTRUCTOR MARKER END]*/
	
	
	public static List list(){
		
		return new EmallservicesDAO().find("from Emallservices");
	}
	
	
	public boolean save(){
		
		new EmallservicesDAO().save(this);
		
		return true;
	}
	
	
	public boolean update(){
		
		new EmallservicesDAO().update(this);
		
		return true;
	}
	
	
	public boolean delete(){
		
		new EmallservicesDAO().delete(this);
		
		return true;
	}
}